/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ch.uzh.ifi.seal.ssqa.model.impl;

import ch.uzh.ifi.seal.ssqa.model.ModelPackage;
import ch.uzh.ifi.seal.ssqa.model.Revision;
import ch.uzh.ifi.seal.ssqa.model.UcmActivity;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Ucm Activity</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.UcmActivityImpl#getIdentifier <em>Identifier</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.UcmActivityImpl#getFileRevisons <em>File Revisons</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.UcmActivityImpl#getHeadline <em>Headline</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class UcmActivityImpl extends EObjectImpl implements UcmActivity {
	/**
	 * The default value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIdentifier()
	 * @generated
	 * @ordered
	 */
	protected static final String IDENTIFIER_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIdentifier()
	 * @generated
	 * @ordered
	 */
	protected String identifier = IDENTIFIER_EDEFAULT;

	/**
	 * The cached value of the '{@link #getFileRevisons() <em>File Revisons</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFileRevisons()
	 * @generated
	 * @ordered
	 */
	protected EList<Revision> fileRevisons;

	/**
	 * The default value of the '{@link #getHeadline() <em>Headline</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHeadline()
	 * @generated
	 * @ordered
	 */
	protected static final String HEADLINE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getHeadline() <em>Headline</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHeadline()
	 * @generated
	 * @ordered
	 */
	protected String headline = HEADLINE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected UcmActivityImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.UCM_ACTIVITY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getIdentifier() {
		return identifier;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIdentifier(String newIdentifier) {
		String oldIdentifier = identifier;
		identifier = newIdentifier;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.UCM_ACTIVITY__IDENTIFIER, oldIdentifier, identifier));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Revision> getFileRevisons() {
		if (fileRevisons == null) {
			fileRevisons = new EObjectResolvingEList<Revision>(Revision.class, this, ModelPackage.UCM_ACTIVITY__FILE_REVISONS);
		}
		return fileRevisons;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getHeadline() {
		return headline;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHeadline(String newHeadline) {
		String oldHeadline = headline;
		headline = newHeadline;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.UCM_ACTIVITY__HEADLINE, oldHeadline, headline));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.UCM_ACTIVITY__IDENTIFIER:
				return getIdentifier();
			case ModelPackage.UCM_ACTIVITY__FILE_REVISONS:
				return getFileRevisons();
			case ModelPackage.UCM_ACTIVITY__HEADLINE:
				return getHeadline();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.UCM_ACTIVITY__IDENTIFIER:
				setIdentifier((String)newValue);
				return;
			case ModelPackage.UCM_ACTIVITY__FILE_REVISONS:
				getFileRevisons().clear();
				getFileRevisons().addAll((Collection<? extends Revision>)newValue);
				return;
			case ModelPackage.UCM_ACTIVITY__HEADLINE:
				setHeadline((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.UCM_ACTIVITY__IDENTIFIER:
				setIdentifier(IDENTIFIER_EDEFAULT);
				return;
			case ModelPackage.UCM_ACTIVITY__FILE_REVISONS:
				getFileRevisons().clear();
				return;
			case ModelPackage.UCM_ACTIVITY__HEADLINE:
				setHeadline(HEADLINE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.UCM_ACTIVITY__IDENTIFIER:
				return IDENTIFIER_EDEFAULT == null ? identifier != null : !IDENTIFIER_EDEFAULT.equals(identifier);
			case ModelPackage.UCM_ACTIVITY__FILE_REVISONS:
				return fileRevisons != null && !fileRevisons.isEmpty();
			case ModelPackage.UCM_ACTIVITY__HEADLINE:
				return HEADLINE_EDEFAULT == null ? headline != null : !HEADLINE_EDEFAULT.equals(headline);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (identifier: ");
		result.append(identifier);
		result.append(", headline: ");
		result.append(headline);
		result.append(')');
		return result.toString();
	}

} //UcmActivityImpl
